<?php
namespace app\payclass\model;

use app\BaseModel;
use think\facade\Db;

class Video extends BaseModel
{
    //定义表名
    protected $name = 'longbing_card_payclass_video';


    /**
     * @author chenniang
     * @DataTime: 2020-12-08 10:51
     * @功能说明:列表
     */
    public function videoList($dis,$page=10,$file = '*'){

        $data = $this->where($dis)->field($file)->order('top desc,id desc')->paginate($page)->toArray();

        return $data;

    }


    /**
     * @author chenniang
     * @DataTime: 2020-12-08 10:51
     * @功能说明:列表
     */
    public function videoSelect($dis,$file = '*'){

        $data = $this->where($dis)->field($file)->order('top desc,id desc')->select()->toArray();

        return $data;

    }

    /**
     * @author chenniang
     * @DataTime: 2020-10-09 17:05
     * @功能说明:配置详情
     */
    public function videoInfo($dis){

        $data = $this->where($dis)->find();

        return !empty($data)? $data->toArray():[];

    }


    /**
     * @author chenniang
     * @DataTime: 2020-09-29 11:04
     * @功能说明:配置添加
     */
    public function videoAdd($data){

        $data['create_time'] = time();

        $data['update_time'] = time();

        $res = $this->insert($data);

        $res = $this->getLastInsID();

        return $res;

    }



    /**
     * @author chenniang
     * @DataTime: 2020-09-29 11:05
     * @功能说明:配置编辑
     */
    public function videoUpdate($dis,$data){

        $data['update_time'] = time();

        $res = $this->where($dis)->update($data);

        return $res;

    }


    /**
     * @author chenniang
     * @DataTime: 2020-10-09 17:05
     * @功能说明:配置详情
     */
    public function videoTopInfo($dis){

        $data = $this->where($dis)->order('top desc')->find();

        return !empty($data)? $data->toArray():[];

    }













}